<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
    <head>
        <th:block th:include="include :: header('排班计划列表')"/>
        <style>
            /*.bootstrap-table tr th .th-inner{*/
            /*    border: 1px solid #F00;*/
            /*}*/

            /*.bootstrap-table tr.no-records-found td {*/

            /*    border: 1px solid #F00;*/
            /*}*/
            /*.table-bordered th, .table-bordered td { border: 1px solid #ddd!important }*/
            .table-height {
                min-height: 75%;
            }

            table.table-bordered {
                border: 1px solid black !important;
                margin-top: 20px;
            }

            table.table-bordered > thead > tr > th {
                border: 1px solid black !important;
            }

            table.table-bordered > tbody > tr > td {
                border: 1px solid black !important;
            }


        </style>
    </head>
    <body class="gray-bg">
        <div class="container-div">
            <div class="row">
<!--                <div class="col-sm-12 search-collapse">-->
<!--                    <form id="formId">-->
<!--                        <div class="select-list">-->
<!--                            <ul>-->
<!--                                <li>-->
<!--                                    <label>班次ID：</label>-->
<!--                                    <input type="text" name="sid"/>-->
<!--                                </li>-->
<!--                                <li>-->
<!--                                    <label>员工ID：</label>-->
<!--                                    <input type="text" name="uid"/>-->
<!--                                </li>-->
<!--                                <li>-->
<!--                                    <label>星期：</label>-->
<!--                                    <input type="text" name="weekDay"/>-->
<!--                                </li>-->
<!--                                <li>-->
<!--                                    <label>值班：</label>-->
<!--                                    <input type="text" name="duty"/>-->
<!--                                </li>-->
<!--                                <li>-->
<!--                                    <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i-->
<!--                                            class="fa fa-search"></i>&nbsp;搜索</a>-->
<!--                                    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i-->
<!--                                            class="fa fa-refresh"></i>&nbsp;重置</a>-->
<!--                                </li>-->
<!--                            </ul>-->
<!--                        </div>-->
<!--                    </form>-->
<!--                </div>-->
                <div class="col-sm-12 select-table table-height">
                    <div class="bootstrap-table bootstrap3">
                        <div class="fixed-table-toolbar">
                            <div class="bs-bars pull-left">
                                <div class="btn-group-sm" id="toolbar" role="group">
                                    <a class="btn btn-success" onclick="$.operate.addTab()">
                                        <i class="fa fa-plus"></i> 添加
                                    </a>
                                    <a class="btn btn-primary single" onclick="edit()">
                                        <i class="fa fa-edit"></i> 修改
                                    </a>
<!--                                    <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">-->
<!--                                        <i class="fa fa-remove"></i> 删除-->
<!--                                    </a>-->
                                    <a class="btn btn-warning" onclick="$.table.exportExcel()">
                                        <i class="fa fa-download"></i> 导出
                                    </a>
                                </div>
                            </div>
                        </div>

                        <div class="fixed-table-container" style="padding-bottom: 0px;">
                            <div class="fixed-table-body" th:with="tid=${teamGroup.id}">
                                <table id="bootstrap-table" class="table table-bordered table-hover"
                                       th:with="bc=${shifts.size}">
                                    <thead class="">
                                    <tr>
                                        <th style="text-align: center;" >
                                            <div class="th-inner ">职员</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center;" th:colspan="${bc}">
                                            <div class="th-inner ">星期一</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center;" th:colspan="${bc}">
                                            <div class="th-inner ">星期二</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center;" th:colspan="${bc}">
                                            <div class="th-inner ">星期三</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center;" th:colspan="${bc}">
                                            <div class="th-inner ">星期四</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center;" th:colspan="${bc}">
                                            <div class="th-inner ">星期五</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; " th:colspan="${bc}">
                                            <div class="th-inner ">星期六</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                        <th style="text-align: center; " th:colspan="${bc}">
                                            <div class="th-inner ">星期日</div>
                                            <div class="fht-cell"></div>
                                        </th>
                                    </tr>
                                    </thead>
                                    <tbody th:with="tds=${7 * bc -1}">
                                    <tr class="no-records-found">
                                        <td></td>
                                        <td th:each="n:${#numbers.sequence(0, tds)}">[[${shifts[n%bc].shift}]]</td>
                                    </tr>
                                    <tr class="no-records-found" th:each="user:${users}">
                                        <td>[[${user.userName}]]</td>
                                        <!--/*--> day表示一个星期中的第几天，1代表星期一，7代表星期日 <!--*/-->
                                        <td th:each="n:${#numbers.sequence(0,tds)}"
                                            th:with="sid=${shifts[n%bc].id},day=${n/bc+1}, key=${#strings.concat(tid,sid,user.userId,day)}"
                                            th:style="${#strings.concat('background:',planMap.get(key)== 1?'#00CCFF':'none')}">
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div class="fixed-table-footer"></div>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
        <th:block th:include="include :: footer" />
        <script th:inline="javascript">
            var editFlag = [[${@permission.hasPermi('his:plan:edit')}]];
            var removeFlag = [[${@permission.hasPermi('his:plan:remove')}]];
            var prefix = ctx + "his/plan";

            $(function() {
                var options = {
                    url: prefix + "/list",
                    createUrl: prefix + "/add",
                    updateUrl: prefix + "/edit/{id}",
                    removeUrl: prefix + "/remove",
                    exportUrl: prefix + "/export",
                    modalName: "排班计划"
                };
                $.table.init(options);
            });

            function edit(){
                let tid = [[${teamGroup.id}]];
                $.operate.editTab(tid);
            }
        </script>
    </body>
</html>